/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fasea.search;

import fasea.index.filehandler.DocumentType;
import fasea.search.documents.Document;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author WolframL
 */
public class SearchResults {

    private List<Document> documents = new ArrayList<Document>();
    private List<Float> score = new ArrayList<Float>();
    private float maxScore = 0;


    private Document getDocument(org.apache.lucene.document.Document doc) {
        return DocumentType.parse(doc.get("documentType")).getDocument(doc);
    }

    void add(org.apache.lucene.document.Document doc, float score){
        documents.add(getDocument(doc));
        this.score.add(score);
        if(score > this.maxScore){
            maxScore = score;
        }
    }

    public int size() {
        return documents.size();
    }

    public Document getDocument(int i) {
        return documents.get(i);
    }

    public Float getNormelizedScore(int i) {
        return score.get(i) / maxScore;
    }
}
